/*     */ package com.lmpop.trade.ti_srcgoods;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.text.SimpleDateFormat;
/*     */ import java.util.Calendar;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ 
/*     */ public class Ti_srcgoodsInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_srcgoodsInfo()
/*     */   {
/*  16 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  25 */     Ti_srcgoods ti_srcgoods = new Ti_srcgoods();
/*  26 */     ti_srcgoods.setSrc_id(map.getString("src_id"));
/*  27 */     ti_srcgoods.setCust_id(map.getString("cust_id"));
/*  28 */     ti_srcgoods.setState_code(map.getString("state_code"));
/*  29 */     ti_srcgoods.setGoods_name(map.getString("goods_name"));
/*  30 */     ti_srcgoods.setGoods_type(map.getString("goods_type"));
/*  31 */     ti_srcgoods.setSend_type(map.getString("send_type"));
/*  32 */     ti_srcgoods.setWeight(map.getString("weight"));
/*  33 */     ti_srcgoods.setVolume(map.getString("volume"));
/*  34 */     ti_srcgoods.setGoods_value(map.getString("goods_value"));
/*  35 */     ti_srcgoods.setPrice(map.getString("price"));
/*  36 */     ti_srcgoods.setName(map.getString("name"));
/*  37 */     ti_srcgoods.setStart_addr(map.getString("start_addr"));
/*  38 */     ti_srcgoods.setPhone(map.getString("phone"));
/*  39 */     ti_srcgoods.setCellphone(map.getString("cellphone"));
/*  40 */     ti_srcgoods.setMsn(map.getString("msn"));
/*  41 */     ti_srcgoods.setQq(map.getString("qq"));
/*  42 */     ti_srcgoods.setEmail(map.getString("email"));
/*  43 */     ti_srcgoods.setEnd_addr(map.getString("end_addr"));
/*  44 */     ti_srcgoods.setIs_pay(map.getString("is_pay"));
/*  45 */     ti_srcgoods.setIs_back_order(map.getString("is_back_order"));
/*  46 */     ti_srcgoods.setSend_time(map.getString("send_time"));
/*  47 */     ti_srcgoods.setInsure_price(map.getString("insure_price"));
/*  48 */     ti_srcgoods.setPay_type(map.getString("pay_type"));
/*  49 */     ti_srcgoods.setPack(map.getString("pack"));
/*  50 */     int end_day = Integer.parseInt(map.getString("end_date"));
/*  51 */     Calendar calendar = Calendar.getInstance();
/*  52 */     calendar.add(5, end_day);
/*  53 */     SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
/*  54 */     String strDate = sf.format(calendar.getTime());
/*  55 */     ti_srcgoods.setEnd_date(strDate);
/*  56 */     ti_srcgoods.setUser_id(map.getString("user_id"));
/*  57 */     ti_srcgoods.setRemark("");
/*     */ 
/*  59 */     String result_code = "0";
/*     */     try {
/*  61 */       insert(dbmMgr, ti_srcgoods);
/*     */     } catch (ApplicationException e) {
/*  63 */       e.printStackTrace();
/*  64 */       result_code = "1";
/*     */     }
/*  66 */     map.setString("result_code", result_code);
/*  67 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_srcgoods ti_srcgoods)
/*     */     throws ApplicationException
/*     */   {
/*  76 */     dbmMgr.update("insertTi_srcgoods", ti_srcgoods);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  86 */     String pkid_string = map.getString("pkid");
/*  87 */     String result_code = "0";
/*     */     try {
/*  89 */       if (!pkid_string.equals("")) {
/*  90 */         String[] pkStr = pkid_string.split("\\|");
/*  91 */         for (int i = 0; i < pkStr.length; i++) {
/*  92 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  96 */       e.printStackTrace();
/*  97 */       result_code = "1";
/*     */     }
/*  99 */     map.setString("result_code", result_code);
/* 100 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/* 109 */     dbmMgr.update("deleteTi_srcgoods", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 118 */     Ti_srcgoods ti_srcgoods = new Ti_srcgoods();
/* 119 */     ti_srcgoods.setSrc_id(map.getString("src_id"));
/* 120 */     ti_srcgoods.setCust_id(map.getString("cust_id"));
/* 121 */     ti_srcgoods.setState_code(map.getString("state_code"));
/* 122 */     ti_srcgoods.setGoods_name(map.getString("goods_name"));
/* 123 */     ti_srcgoods.setGoods_type(map.getString("goods_type"));
/* 124 */     ti_srcgoods.setSend_type(map.getString("send_type"));
/* 125 */     ti_srcgoods.setWeight(map.getString("weight"));
/* 126 */     ti_srcgoods.setVolume(map.getString("volume"));
/* 127 */     ti_srcgoods.setGoods_value(map.getString("goods_value"));
/* 128 */     ti_srcgoods.setPrice(map.getString("price"));
/* 129 */     ti_srcgoods.setName(map.getString("name"));
/* 130 */     ti_srcgoods.setStart_addr(map.getString("start_addr"));
/* 131 */     ti_srcgoods.setPhone(map.getString("phone"));
/* 132 */     ti_srcgoods.setCellphone(map.getString("cellphone"));
/* 133 */     ti_srcgoods.setMsn(map.getString("msn"));
/* 134 */     ti_srcgoods.setQq(map.getString("qq"));
/* 135 */     ti_srcgoods.setEmail(map.getString("email"));
/* 136 */     ti_srcgoods.setEnd_addr(map.getString("end_addr"));
/* 137 */     ti_srcgoods.setIs_pay(map.getString("is_pay"));
/* 138 */     ti_srcgoods.setIs_back_order(map.getString("is_back_order"));
/* 139 */     ti_srcgoods.setSend_time(map.getString("send_time"));
/* 140 */     ti_srcgoods.setInsure_price(map.getString("insure_price"));
/* 141 */     ti_srcgoods.setPay_type(map.getString("pay_type"));
/* 142 */     ti_srcgoods.setPack(map.getString("pack"));
/*     */ 
/* 144 */     String g_type_flag = map.getString("g_type_flag");
/* 145 */     if (g_type_flag.equals("0"))
/*     */     {
/* 147 */       ti_srcgoods.setEnd_date(map.getString("end_date"));
/*     */     }
/*     */     else {
/* 150 */       int end_day = Integer.parseInt(map.getString("s_end_date"));
/* 151 */       Calendar calendar = Calendar.getInstance();
/* 152 */       calendar.add(5, end_day);
/* 153 */       SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
/* 154 */       String strDate = sf.format(calendar.getTime());
/* 155 */       ti_srcgoods.setEnd_date(strDate);
/*     */     }
/*     */ 
/* 159 */     ti_srcgoods.setUser_id(map.getString("user_id"));
/* 160 */     ti_srcgoods.setRemark("");
/*     */ 
/* 162 */     String result_code = "0";
/*     */     try {
/* 164 */       update(dbmMgr, ti_srcgoods);
/*     */     } catch (ApplicationException e) {
/* 166 */       e.printStackTrace();
/* 167 */       result_code = "1";
/*     */     }
/* 169 */     map.setString("result_code", result_code);
/* 170 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_srcgoods ti_srcgoods)
/*     */     throws ApplicationException
/*     */   {
/* 179 */     dbmMgr.update("updateTi_srcgoods", ti_srcgoods);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 189 */     Hashtable ti_srcgoods = (Hashtable)obj;
/* 190 */     if (start == 0)
/* 191 */       start = 0;
/*     */     else {
/* 193 */       start = (start - 1) * limit;
/*     */     }
/* 195 */     ti_srcgoods.put("start", Integer.valueOf(start));
/* 196 */     ti_srcgoods.put("limit", Integer.valueOf(limit));
/* 197 */     return this.queryList.getList("getListByTi_srcgoodsPage", ti_srcgoods);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 208 */     Hashtable ti_srcgoods = (Hashtable)obj;
/* 209 */     List list = this.queryList.getList("getCountByObjTi_srcgoods", ti_srcgoods);
/* 210 */     int count = 0;
/* 211 */     if ((list != null) && (list.size() > 0)) {
/* 212 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 213 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 214 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 217 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 227 */     return this.queryList.getList("getTi_srcgoodsByPk", pk);
/*     */   }
/*     */ 
/*     */   public SysMap updateSrcGoodState(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 236 */     String pkid_string = map.getString("pkid");
/* 237 */     String state_code = map.getString("state_code");
/* 238 */     String result_code = "0";
/*     */     try
/*     */     {
/* 241 */       if (!pkid_string.equals("")) {
/* 242 */         String[] pkStr = pkid_string.split("\\|");
/* 243 */         for (int i = 0; i < pkStr.length; i++)
/*     */         {
/* 245 */           Hashtable psMap = new Hashtable();
/* 246 */           psMap.put("src_id", pkStr[i]);
/* 247 */           psMap.put("state_code", state_code);
/* 248 */           if (pkStr[i].equals("")) continue; updateSrcGoodState(dbmMgr, psMap);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/* 252 */       e.printStackTrace();
/* 253 */       result_code = "1";
/*     */     }
/* 255 */     map.setString("result_code", result_code);
/* 256 */     return map;
/*     */   }
/*     */ 
/*     */   public void updateSrcGoodState(DbmInterf dbmMgr, Hashtable psMap)
/*     */     throws ApplicationException
/*     */   {
/* 266 */     dbmMgr.update("updateTi_srcgoodsState", psMap);
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_srcgoods.Ti_srcgoodsInfo
 * JD-Core Version:    0.6.0
 */